<!DOCTYPE html>
<html>

	<head>
		<title>多彩蓓蕾</title>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
		<meta name="description" content=" ">
		<link rel="stylesheet" href="lib/weui.min.css">
		<link rel="stylesheet" href="css/jquery-weui.css">
		<link rel="stylesheet" href="css/style.css" />

	</head>
	<style>

	</style>

	<body ontouchstart>
		<div class="news">
			<!--<div class="news-box">
				<h3>2017年3月18日</h3>

				<div class="news-list">
					<a href="news.html">
						<div class="new-text">

							<p class="news-info">贵州省六盘水市，盘山公路发生大规模垮塌，造成107国道贵州段临时关闭</p>
							<p class="review">多彩蓓蕾<span>阅读数125</span></p>

						</div>
						<div class="news-img">
							<img class="lazy" data-original="img/001.jpg">
						</div>
					</a>
				</div>
			</div>

			<div class="news-box">
				<h3>2017年3月18日</h3>
				<div class="news-list">
					<a href="news.html">
						<div class="new-text">
							<p class="news-info">贵州省六盘水市，盘山公路发生大规模垮塌，造成107国道贵州段临时关闭</p>
							<p class="review">多彩蓓蕾<span>阅读数125</span></p>
						</div>
						<div class="news-img">
							<img class="lazy" data-original="img/swiper-3.jpg">
						</div>
					</a>
				</div>

				<div class="news-list">
					<a href="news.html">
						<div class="new-text">
							<p class="news-info">贵州省六盘水市，盘山公路发生大规模垮塌，造成107国道贵州段临时关闭</p>
							<p class="review">多彩蓓蕾<span>阅读数125</span></p>
						</div>
						<div class="news-img">
							<img class="lazy" data-original="img/swiper-2.jpg">
						</div>
					</a>
				</div>
			</div>

			<div class="news-box">
				<h3>2017年3月18日</h3>

				<div class="news-list">
					<a href="news.html">
						<div class="new-text">
							<p class="news-info">贵州省六盘水市，盘山公路发生大规模垮塌，造成107国道贵州段临时关闭</p>
							<p class="review">海川化工<span>阅读数125</span></p>
						</div>
						<div class="news-img">
							<img class="lazy" data-original="img/swiper-1.jpg">
						</div>
					</a>
				</div>
			</div>-->

		</div>
		<div class="clear"></div>
		<div class="tabbar">
			<a href="#tab1" class="tab-item">
				<div class="tabbar__icon">
					<img src="img/icon_nav_button.png" alt="">
				</div>
				<p class="tabbar__label">资讯</p>
			</a>

			<a href="#tab3" class="tab-item">
				<div class="tabbar__icon">
					<img src="img/icon_nav_article.png" alt="">
				</div>
				<p class="tabbar__label">直播</p>
			</a>
			<a href="personalcenter.html" class="tab-item">
				<div class="tabbar__icon">
					<img src="img/icon_nav_cell.png" alt="">
				</div>
				<p class="tabbar__label">我的</p>
			</a>
		</div>

		<script src="lib/jquery-2.1.4.js"></script>

		<script src="https://cdn.bootcss.com/jquery_lazyload/1.9.7/jquery.lazyload.js"></script>
		<script src="js/jquery-weui.js"></script>
		<script src="lib/fastclick.js"></script>
		<script>
			$("img.lazy").lazyload({
				placeholder: "img/pic_article.png",
				threshold: 200,
				event: 'scroll',
				//failurelimit : 10 ,
				effect: "fadeIn"
			});
			$(function() {
				FastClick.attach(document.body);

			});

			var pages = 1;
			var sb = 1;
			var loading = false;

			$(document.body).infinite().on("infinite", function() {
				if(loading) return;
				loading = true;
				sb++;
				//分页触底 停止上拉加载
				if($('.weui-loadmore').attr('jiazai') == 0) {
					return false;
				}

				$.ajax({
					type: 'GET',
					url: 'http://cf.588net.com/index.php/api/Article/getList?page=' + sb,

					dataType: 'json',
					success: function(e) {
						//alert(8888)
						var html = '';
						var date = $('.news h3').text();
						//console.log(date);
						//console.log(e.data);
						if(e.code == 200) {
							//console.log(date);
							if(e.data.length == 0) {
								$('.weui-loadmore__tips').text('已经到底了哟！');
								$('.weui-loading').hide();
								$('.weui-loadmore').attr('jiazai', 0);
								return false;
							}
							$.each(e.data, function(a, b) {
									var ss = window.localStorage.setItem('dates', a);
									var sa = localStorage.getItem("dates");
									//console.log(sa);
									//alert(sa);
									if(sa){
										//alert(sa);
										
										
									}
									

									html += '<div class="news-box">';
									html += '<h3>' + a + '</h3>'
									$.each(b, function(c, d) {
										//console.log(d);
										html += '<div class="news-list">';
										html += '<a href="news.html">';
										html += '<div class="new-text">';
										html += '<p class="news-info">' + d.title + '</p>';
										html += '<p class="review">' + d.username + '<span>' + '阅读数' + d.view + '</span></p></div>';
										html += '<div class="news-img">';
										html += '<img class="lazy" data-original="' + d.cover + '">';
										html += '</div>';
										html += '</a>';
										html += '</div>';
									})
									html += '</div>';
									//html+='';
								})
								//alert('ok')
							$('.news').append(html);
							$("img.lazy").lazyload({
								placeholder: "img/pic_article.png",
								threshold: 200,
								event: 'scroll',
								//failurelimit : 10 ,
								effect: "fadeIn"
							});

						}
					},
					error: function() {
						alert("请求出错！");
					}
				})

			});

			$(function() {
				$.ajax({
					//crossOrigin: true,
					//async: false,
					type: 'GET',
					url: 'http://cf.588net.com/index.php/api/Article/getList?page=1',

					dataType: 'json',
					success: function(e) {
						//alert(8888)
						var html = '';
						//var date=$('.news h3').text();
						//console.log(e.data);
						//console.log(e.data);
						if(e.code == 200) {

							//console.log(date);
							$.each(e.data, function(a, b) {
								var s1 = window.localStorage.setItem('dates', a);
								var s2 = localStorage.getItem("dates");

									//console.log(a);
									html += '<div class="news-box">';
									html += '<h3>' + a + '</h3>'
									$.each(b, function(c, d) {
										//console.log(d);
										html += '<div class="news-list">';
										html += '<a href="news.html">';
										html += '<div class="new-text">';
										html += '<p class="news-info">' + d.title + '</p>';
										html += '<p class="review">' + d.username + '<span>' + '阅读数' + d.view + '</span></p></div>';
										html += '<div class="news-img">';
										html += '<img class="lazy" data-original="' + d.cover + '">';
										html += '</div>';
										html += '</a>';
										html += '</div>';
									})
									html += '</div>';
									//html+='';
								})
								//alert('ok')
							$('.news').append(html);
							$("img.lazy").lazyload({
								placeholder: "img/pic_article.png",
								threshold: 200,
								event: 'scroll',
								//failurelimit : 10 ,
								effect: "fadeIn"
							});

						}
					},
					error: function() {
						alert("请求出错！");
					}
				})

			})
		</script>

	</body>

</html>